<template>
    <div>

    </div>
</template>

<script>
    import {
        mapMutations
    } from 'vuex'
    export default {
        data() {
            return {

            }
        },
        methods: {
            ...mapMutations(['closeTag', 'removeCatchPages']),
            close(name, params) {
                /**
                 * 如果是调用closeTag方法，普通的页面传入的对象参数只需要写name字段即可
                 * 如果是动态路由和带参路由，需要传入query或params字段，用来区别关闭的是参数为多少的页面
                 */
                this.removeCatchPages(name)
                this.closeTag({
                    name,
                    params
                });
            },
        },

        created() {
            // console.log(this.$route);

            let name = this.$route.params.name
            let title = this.$route.params.title
            let params = this.$route.params.oldParams

            this.close('reload-page', this.$route.params)
            this.close(name, params)
            // console.log(this.$route.params.name);

            let timer = setTimeout(() => {
                this.$router.push({
                    name,
                    params
                });
                clearTimeout(timer)
            }, 10);


        }
    }
</script>

<style lang='less' scoped>

</style>